package com.yuandian.management.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuandian.api.management.entity.ConfBlacklistResource;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.management.service.ConfBlackListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/**
 * -Controller
 * @author zfsn
 * @date 2023-5-11
 */
@Api(tags = "IT云化资源配置-黑名单")
@RestController
@RequestMapping("/blackList")
public class ConfBlackListController {

	@Autowired
	private ConfBlackListService confBlackListService;

	/**
	 * 分页查询
	 * @param confBlacklistResource 筛选条件
	 * @return 通用返回对象
	 */
	@ApiOperation(value = "分页查询", notes = "分页查询")
	@PostMapping
	@ApiImplicitParams({
			@ApiImplicitParam(name = "confirmedUrl", value = "黑名单URL(支持模糊查询)", paramType = "body", required = false, dataType = "String"),
			@ApiImplicitParam(name = "pageSize", value = "每页大小", paramType = "body", required = true, dataType = "Integer"),
			@ApiImplicitParam(name = "pageNum", value = "当前页数", paramType = "body", required = true, dataType = "Integer"),
	})
	public R<Page<ConfBlacklistResource>> listPage(@RequestBody @ApiIgnore ConfBlacklistResource confBlacklistResource) {
		return R.ok(confBlackListService.listPage(confBlacklistResource));
	}



	/**
	 * 删除服务资源黑名单
	 *
	 * @param brv 参数
	 * @return Result
	 */
	@ApiOperation(value = "删除服务资源黑名单", notes = "删除服务资源黑名单")
	@PostMapping("/deleteBlackList")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "confirmedUrl", value = "黑名单URL", paramType = "body", required = true, dataType = "String"),
	})
	public R<String> deleteBlackList(@RequestBody @ApiIgnore ConfBlacklistResource brv) {
		return confBlackListService.deleteBlackList(brv);
	}
}
